let isUsername = false;
let isPassword = false;

let ipts = document.querySelectorAll(".register-body9");
// console.log(ipts);
// console.log(ipts[0]);
// console.log(ipts[1]);

ipts[0].onblur = function(){
    let reg = /^[a-z]\w{5,17}$/i;
    if(reg.test(ipts[0].value)){
        console.log(111);
        isUsername=true;
    }else{
        isUsername=false;
    }
}

ipts[1].onblur = function(){
    let reg = /^\S{6,16}$/;
    if(reg.test(ipts[1].value)){
        console.log(222);
        isPassword=true;
    }else{
        isPassword=false;
    }

    let ipt2 = document.querySelector("button");
    console.log(ipt2);
    ipt2.onclick = function(){
        let username = ipts[0].value;
        let password = ipts[1].value;
        axios.get(loginAPI,{
            params: {username,password},
        }).then((res)=>{
            let {data}=res;
            console.log(data);
            localStorage.setItem("uid",data.data.id);
            localStorage.setItem("username",data.data.username);
            localStorage.setItem('token',data.data.token);
            alert(data.msg);
            if(data.code == 1){
                location.href="index-首页.html";
            }
        })
    }
}